/**
 * 
 */
package com.revenco.bi.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.revenco.bi.controller.basecontroller.AbstractUserAwareController;
import com.revenco.bi.model.TnColumnInfo;
import com.revenco.bi.service.TnColumnInfoService;
import com.revenco.bi.service.TnOthtableMaintableRelaService;
import com.revenco.bi.service.TnTableInfoService;

/**
 * @author LingJun
 * @version $Revision:1.0.0, 2014年1月13日 下午1:12:34 
 */
@Controller
public class TnColumnInfoController extends AbstractUserAwareController {
	@Autowired
	private TnColumnInfoService tnColumnInfoService;
	@Autowired
	private TnTableInfoService tnTableInfoService;
	@Autowired
	private TnOthtableMaintableRelaService tnOthtableMaintableRelaService;
	
	/**
	 * 根据表 id, 获取表字段信息
	 * @param tableId
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getTreeLeaves")
	@ResponseBody
	public List<TnColumnInfo> getTreeLeaves(@RequestParam("tableId") String tableId) throws Exception {
		List<TnColumnInfo> listColumn = null;
		
		listColumn = tnColumnInfoService.getColumnsByTableId(tableId);
		log.info("Column size: {}", listColumn.size());
		
		return listColumn;
	}
	
	@RequestMapping(value = "/initParams/initMinMonth")
	@ResponseBody
	public Object initMinMonth() throws Exception {
		return null;
	}
	
}
